home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / shuffleManipHandleIndex.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.9 KB  |  154 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // Alias|Wavefront Script File
  19. // MODIFY THIS AT YOUR OWN RISK
  20. //
  21. // Creation Date:  17 January 97
  22. // Author:         jb
  23. //
  24. //
  25. //  Procedure Name:
  26. //        shuffleManipHandleIndex
  27. //
  28. //  Description:
  29. //
  30. //        Allows user to cycle through the handles on
  31. //        the transformation manips, both forwards and
  32. //        backwards.  Passing in 1 indexes up, and -1
  33. //        indexes down.  Could be extended to other 
  34. //        manip types, if they gain the ability to set
  35. //        their active handles.
  36. //
  37. //  Input Arguments:
  38. //        -next
  39. //        -previous
  40. //
  41. //  Return Value:
  42. //      None.
  43. //
  44.  
  45. global proc shuffleManipHandleIndex( string $shuffle )
  46. {
  47.     global string $gMove, $gRotate, $gScale;
  48.     //
  49.     // Get the current context
  50.     //
  51.     string $currentCtx = `currentCtx`;
  52.     string $cmdString;
  53.     int $increment;
  54.  
  55.     if( $shuffle == "-next" ) {
  56.         $increment = 1;
  57.     } else {
  58.         $increment = -1;
  59.     }
  60.  
  61.     if( $currentCtx == $gMove ) {
  62.         if (`superCtx -q $gMove` != "Move") return;
  63.         //
  64.         // Get the currently active handle on
  65.         // the move context
  66.         //
  67.         int $newAH = `manipMoveContext -q -ah Move`;
  68.         $newAH = ( $newAH + $increment );
  69.         if( $newAH == 4 ) {
  70.             //
  71.             // Index is greater than 4, so set
  72.             // it back to 0 to allow cycling
  73.             //
  74.             $newAH = 0;
  75.         }
  76.         if( $newAH == -1 ) {
  77.             //
  78.             // Index is less than 0, so set it
  79.             // back to 3 to allow cycling
  80.             //
  81.             $newAH = 3;
  82.         }
  83.         // Build the command string to execute to change the active
  84.         // manip handle
  85.         //
  86.         $cmdString = ( "manipMoveContext -e -ah "+$newAH+" Move" );
  87.         eval $cmdString;
  88.         return;
  89.     }
  90.     if( $currentCtx == "Rotate" ) {
  91.         //
  92.         // Get the currently active handle on
  93.         // the rotate context
  94.         //
  95.         int $newAH = `manipRotateContext -q -ah $currentCtx`;
  96.         $newAH = ( $newAH + $increment );
  97.         if( $newAH == 3 ) {
  98.             //
  99.             // Index is greater than 2, so set
  100.             // it back to 0 to allow cycling - note
  101.             // that the screen aligned handle is
  102.             // being filtered out here - set this
  103.             // to 4 to get the screen aligned handle
  104.             // included in the cycling.
  105.             //
  106.             $newAH = 0;
  107.         }
  108.         if( $newAH == -1 ) {
  109.             //
  110.             // Index is less than 0, so set it
  111.             // back to 2 to allow cycling
  112.             //
  113.             $newAH = 2;
  114.         }
  115.         // Build the command string to execute to change the active
  116.         // manip handle
  117.         //
  118.         $cmdString = ( "manipRotateContext -e -ah "+$newAH+" "+$currentCtx );
  119.         eval $cmdString;
  120.         return;
  121.     }
  122.     if( $currentCtx == $gScale ) {
  123.         if (`superCtx -q $gScale` != "Scale") return; 
  124.         //
  125.         // Get the currently active handle on
  126.         // the scale context
  127.         //
  128.         int $newAH = `manipScaleContext -q -ah "Scale"`;
  129.         $newAH = ( $newAH + $increment );
  130.         if( $newAH == 4 ) {
  131.             //
  132.             // Index is greater than 4, so set
  133.             // it back to 0 to allow cycling
  134.             //
  135.             $newAH = 0;
  136.         }
  137.         if( $newAH == -1 ) {
  138.             //
  139.             // Index is less than 0, so set it
  140.             // back to 3 to allow cycling
  141.             //
  142.             $newAH = 3;
  143.         }
  144.         // Build the command string to execute to change the active
  145.         // manip handle
  146.         //
  147.         $cmdString = ( "manipScaleContext -e -ah "+$newAH+" Scale" );
  148.         eval $cmdString;
  149.         return;
  150.     }
  151. }
  152.  
  153.  
  154.